#from myelin.Ns import MYELINS
#from myelin.server.core.ft import ModelDriver

#from nodetypes.formats.mml.Events import Form
from nodetypes.ntypes.GuestAccount.edit_preferences.libmml.forms.Reset import Form

#from nodetypes.models.Theme import Theme


class Form(Form):
    pass
    #newThemeModel = Theme
    #newModelDriver = staticmethod(ModelDriver.FromRepo)
    #
    #def createInstance (self, context, node):
    #    args = context.request.args
    #    
    #    model = context.model
    #    preferences = context.preferences
    #    
    #    locale = preferences['locale']
    #    theme = preferences['theme']
    #    
    #    nxa = node.xml_append
    #    nxc = node.xml_create_element
    #    
    #    nxa(
    #        nxc(
    #            u'a:title', MYELINS,
    #            content = model.rdf_join('dcTitle')
    #        )
    #    )
    #            
    #    self.createLocaleOptions(
    #        context,
    #        nxa(
    #            nxc(
    #                u'a:xlocale', MYELINS,
    #                attributes = {
    #                    u'selected'     : locale,
    #                }
    #            )
    #        ),
    #        locale
    #    )
    #    
    #    self.createThemeOptions(
    #        context,
    #        nxa(
    #            nxc(
    #                u'a:xtheme', MYELINS,
    #                attributes = {
    #                    u'selected'     : theme,
    #                }
    #            )
    #        ),
    #        locale,
    #        theme
    #    )
    #    
    #    return node
    #
    #
    #def createLocaleOptions(self, context, node, locale):
    #    node.selected = locale
    #    
    #    opts = node.xml_append(
    #        node.xml_create_element(
    #            u'a:options', MYELINS
    #        )
    #    )
    #    
    #    oxa = opts.xml_append
    #    oxc = opts.xml_create_element
    #    
    #    for l in context.i18nResources.keys():
    #        oxa(
    #            oxc(
    #                u'a:option', MYELINS,
    #                attributes = {
    #                    u'key'  : l,
    #                }
    #            )
    #        )
    #        
    #    return node
    #
    #
    #def createThemeOptions(self, context, node, locale, theme):
    #    node.selected = theme
    #    
    #    opts = node.xml_append(
    #        node.xml_create_element(
    #            u'a:options', MYELINS
    #        )
    #    )
    #    
    #    oxa = opts.xml_append
    #    oxc = opts.xml_create_element
    #    
    #    defaults = context.defaults
    #    
    #    newTheme = self.newThemeModel
    #    dbDriver = newTheme.Initialize(
    #        self.newModelDriver(
    #            context.session.repo,
    #            context.server.graphs.get('i18n')
    #        )
    #    )        
    #    newTheme = newTheme.Retrieve
    #    
    #    for k,v in context.i18nResources[locale].themes.items():
    #        k = oxa(
    #            oxc(
    #                u'a:option', MYELINS,
    #                attributes = {
    #                    u'key'  : k,
    #                }
    #            )
    #        )
    #        
    #        k = k.xml_append(
    #            k.xml_create_element(
    #                u'a:theme', MYELINS,
    #                attributes = {
    #                    u'node-id'  : v,
    #                }
    #            )
    #        )
    #        
    #        kxa = k.xml_append
    #        kxc = k.xml_create_element
    #        
    #        n = newTheme(dbDriver, v)
    #        n_join = n.rdf_join
    #        
    #        kxa(
    #            kxc(
    #                u'a:title', MYELINS,
    #                content = n_join('dcTitle')
    #            )
    #        )
    #        
    #        kxa(
    #            kxc(
    #                u'a:description', MYELINS,
    #                content = n_join('dcDescription')
    #            )
    #        )
    #        
    #    return node